/********************************************************************************
 *
 *
 *
 *
 ********************************************************************************/
 
 
 #include "SD_Storage.h"
#include "mbed.h"
#include "SDFileSystem.h"

SDFileSystem sd(p5, p6, p7, p8, "sd"); // the pinout on the mbed Cool Components workshop board


void write_to_SD_Storage(int circuit_Number, float voltage, float current, float power, float phase_Angle, float power_Factor)
{
    FILE *fp = fopen("/sd/mydir/powerMeter.csv", "a");
    fprintf(fp, "%d, ", circuit_Number); 
    fprintf(fp,"%f, %f, %f, %f, %f\n", voltage, current, power, phase_Angle, power_Factor); 
    fclose(fp); 
}   